#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/8/31 9:42
# @Author  : njl
# @File    : center_ui_api.py

import requests
from . import base_api 
# from Lib import get_host_ip
# from its_auth.lib import  get_share_dir


class CenterUiApi(base_api.BaseConn):
    """send the data to server"""
    def __init__(self, **kwargs):
        """
        kwargs ={ user_name='njl',file_path=r'D:\temp',file_save_path=r'Q:\test'}
        """
        super(CenterUiApi, self).__init__()
        # 接收数据转换为字典
        self.data = kwargs
        # 得到主机IP
        # host_ip = get_host_ip()
        # # 转换为网络共享地址，并更新字典
        # if self.data.has_key('file_name'):
        #     self.data['file_name'] = r'\\'+host_ip+'\\' + self.data['file_name'].replace(':', '')

    def send_data(self, controller='api'):
        print('sent the Data to  server')
        print(self.data)
        return requests.get(self.url, params=self.data)


